package com.tianpengtech.common.mock.impl.string;

import com.tianpengtech.common.mock.impl.AbstractNumberMock;
import com.tianpengtech.common.mock.impl.AbstractStringMock;
import com.tianpengtech.common.mock.impl.numberic.IntegerMock;

public class EmailMock extends AbstractStringMock{

	private String[] email = {"@qq","@126","@163","@apple","@gmail","@alibaba"};
	private String[] email_suffix = {".edu",".com",".org",".net",".io",".cc"};
	
	@Override
	public String mockData() {
		
		AbstractNumberMock<Integer> iMock = new IntegerMock();
		int i = iMock.mockData(0, email.length);
		int j = iMock.mockData(0, email_suffix.length);
		String prefix = mockPrefix(iMock);
		return prefix+email[i]+email_suffix[j];
	}
	
	private String mockPrefix(AbstractNumberMock<Integer> iMock){
		
		StringBuffer sb = new StringBuffer();
		int index = iMock.mockData(1,number.length);
		for (int i = 0; i < index; i++) {
			int cIndex = iMock.mockData(0, character.length);
			sb.append(character[cIndex]);
		}
		return sb.toString();
	}

}
